import request from '@/utils/request'

// 租房合同列表
export function leaseContractList(query) {
  return request({
    url: '/finance/finance/lease_contract_list',
    method: 'get',
    params: query
  })
}

// 租房合同详情
export function detail(query) {
  return request({
    url: '/finance/finance/detail',
    method: 'get',
    params: query
  })
}

//列表 - 金融产品
export function listProduct() {
  return request({
    url: '/finance/finance/list_product',
    method: 'get',
  })
}

// 计算 - 列表
export function listCompute(query) {
  return request({
    url: '/finance/finance/list_compute',
    method: 'post',
    data: query
  })
}

// 保存 - 分期申请
export function save(query) {
  return request({
    url: '/finance/finance/save',
    method: 'post',
    data: query
  })
}


//列表
export function getLists(data) {
  return request({
    url: 'finance/contract/list',
    method: 'get',
    params: {
      ownerName: data.ownerName,
      premiseName: data.premiseName,
      current: data.current,
      size: data.size,
    }
  })
}

//根据ID查询
export function contractListById(data) {
  return request({
    url: 'finance/contract/contractListById',
    method: 'get',
    params: {
      id: data,
    }
  })
}

//根据ID查询
export function productById(data) {
  return request({
    url: 'finance/product/productById',
    method: 'get',
    params: {
      id: data,
    }
  })
}

//金融产品选择下拉框
export function queryJrProduct(data) {
  return request({
    url: 'finance/contract/queryJrProduct',
    method: 'get',
    params: {}
  })
}

//分期计算详情
export function listSfLoan(data) {
  return request({
    url: 'finance/contract/listSfLoan',
    method: 'get',
    params: {
      productId: data.productId,
      contractId: data.id,
      periods: data.periods,
      startDate: data.startDate,
      endDate: data.endDate,
      rate: data.rate,
      serviceFee: data.serviceFee,
      balance: data.balance,
      sxBalance: data.sxBalance
    }
  })
}

//提交申请
export function savesf(data) {
  return request({
    url: 'finance/loan/savesf',
    method: 'post',
    data: data
  })
}


//列表
export function getList(data) {
  return request({
    url: 'finance/rent/list',
    method: 'get',
    params: {
      jrProductType: data.jrProductType,
      applyState: data.applyState,
      startDate: data.startDate,
      endDate: data.endDate,
      current: data.current,
      size: data.size,
    }
  })
}

//获取申请类型
export function getType() {
  return request({
    url: 'finance/rent/getType',
    method: 'get',
    params: {}
  })
}

//获取申请状态
export function getState() {
  return request({
    url: 'finance/rent/getState',
    method: 'get',
    params: {}
  })
}

//判断 融资申请审核操作 页面 审核按钮隐藏（显示）
export function rentingAuditView(data) {
  return request({
    url: 'finance/rent/rentingAuditView',
    method: 'get',
    params: {
      cfContractId: data.cfContractId,
      applyState: data.applyState,
      id: data.id,
      jrProductType: data.jrProductType,
    }
  })
}

//租房分期审核通过
export function test1(data) {
  return request({
    url: 'finance/rent/test1',
    method: 'get',
    params: {
      applyState: data.applyState_Show_Hidden,
      id: data.id,
    }
  })
}

//租房分期审核不通过
export function test2(data) {
  return request({
    url: 'finance/rent/test2',
    method: 'get',
    params: {
      applyState: data.applyState_Show_Hidden,
      id: data.id,
    }
  })
}

//租房分期审核通过
export function test3(data) {
  return request({
    url: 'finance/rent/test3',
    method: 'get',
    params: {
      applyState: data.applyState_Show_Hidden,
      id: data.id,
    }
  })
}

//租房分期审核不通过
export function test4(data) {
  return request({
    url: 'finance/rent/test4',
    method: 'get',
    params: {
      applyState: data.applyState_Show_Hidden,
      cfContractId: data.cfContractId,
      id: data.id,
    }
  })
}

//应收租约保理审核通过
export function test5(data) {
  return request({
    url: 'finance/rent/test5',
    method: 'get',
    params: {
      applyState: data.applyState_Show_Hidden,
      id: data.id,
    }
  })
}

//应收租约保理审核不通过
export function test6(data) {
  return request({
    url: 'finance/rent/test6',
    method: 'get',
    params: {
      applyState: data.applyState_Show_Hidden,
      cfContractId: data.cfContractId,
      id: data.id,
    }
  })
}

//应收租约保理查看
export function factoringDetailsView(data) {
  return request({
    url: 'finance/rent/factoringDetailsView',
    method: 'get',
    params: {
      id: data.id,
      cfContractId: data.cfContractId,
      factoringId: data.factoringId,
    }
  })
}
